home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 4
/
Gold Medal Software - Volume 4 (Gold Medal) (1994).iso
/
os2
/
sqav184e.arj
/
KAREA10E.ZIP
/
KILLAREA.CMD
next >
Wrap
OS/2 REXX Batch file
|
1994-01-11
|
4KB
|
133 lines
/* Program: KILLAREA v1.01 */
/* Filename: KILLAREA.CMD */
/* Author: Martin Mirgel, 2:2456/99@fidonet */
/* 16:100/5529zyxelnet.org */
/* 23:700/1@kultnet */
/* Last change: 11.1.94 */
/* */
/* This program is freeware. Commercial use by */
/* companies or institutions is strictly forbidden. */
/* Selling this program on shareware-disks is not */
/* allowed, too. */
'@echo off'
call rxfuncadd 'SYSFILETREE','REXXUTIL','SYSFILETREE'
call rxfuncadd 'SYSFILEDELETE','REXXUTIL','SYSFILEDELETE'
globalFound=false
say 'KILLAREA v1.01 (C)1994 by M.Mirgel (2:2456/99@fidonet.de)'
if (arg(1,exists)=0) then do
say 'please use: KILLAREA <MESSAGECTL> <KILLAREA.TXT> [/E]'
exit
end
parse upper arg areafile killfile option
if option = '/E' then emptyAreas = true
if killfile='' then do
say 'please use: KILLAREA <MESSAGECTL> <KILLAREA.TXT> [/E]'
exit
end
/* areafile exists ? */
call sysfiletree areafile,'FILE','F'
if file.0=0 then do
say 'MSGAREA-File not found !'
exit
end
/* killareafile exists ? */
call sysfiletree killfile,'FILE','F'
if file.0=0 then do
say 'KILLAREA-File not found !'
exit
end
/* scan the KILLAREA.TXT */
do until lines(killfile)=0
line=linein(killfile)
areatag=translate(word(line,1))
rc=sysfiledelete('MSGAREA.TMP')
/* search 'til the specific areatag is found */
found=false
i=1
do until ((lines(areafile)=0) | (found=true))
arealine.i=linein(areafile)
if (translate(word(arealine.i, 1)) = 'MSGNAME') & (translate(word(arealine.i, 2)) = areatag) then found=true
else i=i+1
end
if found=true then globalFound=true
/* if the areatag not exists, just close the areafile */
if found=false then call lineout areafile
else do
/* 'spool back' to the beginning of the area-description */
j=i
do until translate(word(arealine.j,1)) = 'AREA'
j=j-1
end
/* save all lines until the first area-line is reached */
k=1
do until k=j
call lineout 'MSGAREA.TMP', arealine.k
k=k+1
end
if emptyAreas=true then do
call lineout 'MSGAREA.TMP', arealine.k
j=j+1
end
/* now save all previously read lines with a preceding semicolon */
do l=j to i
call lineout 'MSGAREA.TMP', insert(';',arealine.l)
end
/* read in the missing lines of the area-description an save it as a comment */
do until ((lines(areafile)=0) | translate(word(line,1))='END')
line=linein(areafile)
if (translate(word(line,1))='END') & (emptyAreas = true) then call lineout 'MSGAREA.TMP', line
else call lineout 'MSGAREA.TMP', insert(';',line)
end
/* save the rest of the file without change */
do until lines(areafile)=0
line=linein(areafile)
call lineout 'MSGAREA.TMP', line
end
/* close file */
call lineout 'MSGAREA.TMP'
call lineout areafile
/* temp.File = CTL-File */
'@copy ' 'MSGAREA.TMP' areafile
end
end
call lineout killfile
rc=sysfiledelete('MSGAREA.TMP')
if globalFound=true then exit 1
else exit 0